package com.itheima.dubbo.web;

import com.itheima.dubbo.UserInterface;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.rpc.RpcContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

//    @DubboReference(methods = {@Method(
//            name ="hello",timeout = 3000
//    )})
//    @DubboReference(retries = 0)
    @DubboReference(loadbalance = "roundrobin")
    UserInterface userInterface;
    @GetMapping("/hello")
    public String hello(String username) {
        RpcContext.getContext().setAttachment("index","隐式参数设置");
        return userInterface.hello(username);
    }
}
